home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / dev / lang / amigatalk.lha / intuition / GadgetActivation.st < prev    next >
Text File  |  2002-03-15  |  2KB  |  64 lines

  1. " -------------------------------------------------------------------- "
  2. " GadgetActivation Class is a Singleton class that allows the user to  "
  3. " reference Gadget Activation flags without having to remember their   "
  4. " actual hexadecimal values.                                           "
  5. ""
  6. " The User does NOT need to create one of these, since Intuition Class "
  7. " will instantiate the only needed instance of this Class.  See the    "
  8. " SetupIntuition.st source file for the method(s) that help the User   "
  9. " with this Class.                                                     "
  10. ""
  11. "  EXAMPLE:  'myTag <- intuition getGadgetActivation: #GACT_RELVERIFY' "
  12. ""
  13. " ALL singleton classes MUST contain the following:                    "
  14. ""
  15. "   the methods:  isSingleton AND privateSetup     AND                 "
  16. "                 uniqueInstance Class instance variable.              "
  17. " -------------------------------------------------------------------- "
  18.  
  19. Class GadgetActivation :Dictionary ! uniqueInstance !
  20. [
  21.    isSingleton
  22.      ^ true  
  23. |  
  24.    privateNew ! newinstance !
  25.      newinstance <- super new.
  26.  
  27.      ^ newinstance
  28. |
  29.    new
  30.      ^ (self privateSetup)
  31. |
  32.    privateSetup
  33.      (uniqueInstance isNil)
  34.        ifTrue: [uniqueInstance <- self privateNew.
  35.  
  36.                 self at: #GACT_STRINGLEFT   put: 0. 
  37.                 self at: #GACT_RELVERIFY    put: 1.
  38.                 self at: #GACT_IMMEDIATE    put: 2.
  39.                 self at: #GACT_ENDGADGET    put: 4.
  40.                 self at: #GACT_FOLLOWMOUSE  put: 8.
  41.  
  42.                 self at: #GACT_RIGHTBORDER  put: 16r10.
  43.                 self at: #GACT_LEFTBORDER   put: 16r20.
  44.                 self at: #GACT_TOPBORDER    put: 16r40.
  45.                 self at: #GACT_BOTTOMBORDER put: 16r80.
  46.      
  47.                 self at: #GACT_TOGGLESELECT put: 16r100.
  48.                 self at: #GACT_STRINGCENTER put: 16r200.
  49.                 self at: #GACT_STRINGRIGHT  put: 16r400.
  50.                 self at: #GACT_LONGINT      put: 16r800.
  51.  
  52.                 self at: #GACT_ALTKEYMAP    put: 16r1000.
  53.                 self at: #GACT_BOOLEXTEND   put: 16r2000.
  54.                 self at: #GACT_STRINGEXTEND put: 16r2000.
  55.                 self at: #GACT_ACTIVEGADGET put: 16r4000.
  56.  
  57.                 "Neither set nor rely on this bit:"
  58.  
  59.                 self at: #GACT_BORDERSNIFF  put: 16r8000. 
  60.                ].
  61.                
  62.      ^ self "uniqueInstance??"
  63. ]
  64.